package com.az.miaoapi.response;

import lombok.Getter;

/**
 * 返回状态码
 */
@Getter
public enum ResponseCode {
    /**
     * 成功返回的状态码
     */
    SUCCESS(10200, "success"),

    /**
     * 修改失败统一返回值
     */
    TRY_AGAIN(10201, "服务器繁忙，请重试"),

    /**
     * 用户不存在
     */
    USER_NOT_EXIST(10202, "用户不存在"),

    /**
     * 响应格式错误
     */
    RESPONSE_FORMAT_ERROR(10203, "响应格式错误(后端响应格式修改)"),

    /**
     * 令牌失效
     */
    TOKEN_INVALIDATION(10204, "令牌失效"),


    NOT_LOGIN(10205, "未登录"),


    /**
     * 所有无法识别的异常默认的返回状态码
     */
    SERVICE_ERROR(50000, "服务器异常"),


    /**
     * 自定义状态码
     */
    GET_ADDRESS_FAILED(10606, "地址获取失败，请先添加默认地址"),
    CREATE_ORDER_FAILED(10605, "创建订单失败"),
    UPDATE_PRODUCT_TYPE_FAILED(10604, "修改购物车类型失败"),
    TYPE_AMOUNT_IS_ZERO(10603, "当前商品类型数量为0"),
    ADD_PRODUCT_TYPE_FAILED(10602, "添加购物车类型失败"),
    DELETE_PRODUCT_IN_SHOPPINGCART_FAILED(10601, "删除购物车中的商品失败"),
    PRODUCT_NOT_IN_SHOPPINGCART(10600, "商品不在购物车中"),


    UPLOAD_FAILED(10300, "文件上传失败"),
    WAIT_ADDRESS(100301, "服务器繁忙，稍后再试哦"),

    INSUFFICIENT_PERMISSIONS(10401, "权限不足"),
    LOGIN_FAILED(10402, "信息认证失败"),
    USERNAME_REPEAT(104003, "用户名已存在"),
    EMAIL_REPEAT(104004, "邮箱已存在"),
    EMAIL_ILLEGAL(104005, "邮箱不合法"),
    CODE_OVERDUE(104006, "验证码过期"),
    SEND_EMAIL_FAIL(104007, "邮件发送失败"),
    QUESTION_NOT_EXIST(104008, "无法查询到密保问题"),
    QUESTION_BIND_FAIL(104009, "密保验证失败"),

    // 监督官
    MESSAGE_NULL_ERROR(10500, "更新的信息不能都为空"),
    UPDATE_USERMESSAGE_FAILED(10501, "更新用户信息失败"),
    NOT_FOUND_USERMESSAGE(10502, "未找到用户信息"),
    PAY_FAILED(10510, "支付失败"),
    ORDER_STATUS_EXCEPTION(10511, "订单状态异常"),
    DELETE_ORDER_FAILED(10512, "删除订单失败"),
    LACK_PRODUCT_ERROR(10513, "库存不足"),
    NO_PRODUCT(10514, "没找到该产品"),
    NO_OEDERDETAIL(10515, "没找到订单详情"),
    NO_ADDRESS(10516, "没找到收货地址"),
    NO_THIS_TYPE(10517, "没有该类型(数据库异常)"),
    NOT_FIND_ITEM(10518, "没找到该产品"),
    COMMENT_TOO_SHORT(10519, "评论不得低于十个字"),
    COMMENT_TOO_LONG(10520, "评论不得高于五十个字"),
    NO_BUY(10521, "没有评论资格，请购买后再评论"),
    INSERT_FAILED(10522, "评论失败"),
    NOT_FIND_ORDER(10523, "没找到符合条件的订单"),


    /**
     * liucb
     */
    PRODUCT_NOT_EXIST(10700, "产品不存在"),
    PAGE_QUERY_ERROR(10701, "分页查询失败"),
    ADDRESS_NOT_EXIST(10702, "地址不存在"),
    PRODUCT_TYPE_NOT_FOUND(10703, "产品配置不存在"),
    CATEGORY_NOT_EXIST(10704, "类型不存在"),
    REMOTE_SERVICE_ERROR(10705,"远程调用服务失败" );


    //状态码
    private final int code;

    //描述信息
    private final String msg;

    ResponseCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
